/**
 * @program: clms-second
 * @description: 汽车配置控制层
 * @author: mitu_echo
 * @create: 2021-07-25 08:55
 **/

package com.second.lease.controller;

import com.second.common.pojo.R;
import com.second.lease.pojo.entity.CarConfig;
import com.second.lease.pojo.vo.CarConfigVO;
import com.second.lease.service.CarConfigService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/carconfig")
public class CarConfigController {

    @Autowired
    private CarConfigService carConfigService;

    /**
     * 查询汽车所有配置
     * @param carConfigVO 查询汽车配置参数
     * @return
     */
    @ApiOperation("查询汽车所有配置")
    @RequestMapping("/showAllCarConfig")
    private R showAllCarConfig(CarConfigVO carConfigVO) {

        return carConfigService.showAllCarConfig(carConfigVO);
    }


    /**
     * 修改汽车配置
     * @param carConfig 汽车配置信息
     * @return
     */
    @ApiOperation("修改汽车配置")
    @RequestMapping("/updateCarConfig")
    private R updateCarConfig(@RequestBody CarConfig carConfig) {

        return carConfigService.updateCarConfig(carConfig);
    }

    /**
     * 新增汽车配置
     * @param carConfig 汽车配置信息
     * @return
     */
    @ApiOperation("新增汽车配置")
    @RequestMapping("/addCarConfig")
    private R addCarConfig(@RequestBody CarConfig carConfig) {

        return carConfigService.addCarConfig(carConfig);
    }

    /**
     * 删除汽车配置
     * @param id 汽车配置id
     * @return
     */
    @ApiOperation("删除汽车配置")
    @RequestMapping("/deleteCarConfigById")
    private R deleteCarConfigById(Integer id) {

        return carConfigService.deleteCarConfigById(id);
    }
}
